import React from 'react'
import { useSelector, useDispatch } from 'react-redux'
import { push } from './redux/actions'
export default function List() {
  const list = useSelector((state) => {
    return state.ls.list
  })
  const dispatch = useDispatch()
  return (
    <>
      <button
        onClick={() => {
          dispatch(push('d'))
        }}
      >
        添加数据
      </button>
      <ul>
        {list.map((item, index) => {
          return <li key={index}>{item}</li>
        })}
      </ul>
    </>
  )
}
